package com.gigmissions.client;

import com.gigmissions.client.config.GigMissionsConstants;
import com.gigmissions.client.config.GigMissionsMessages;
import com.google.gwt.inject.client.AbstractGinModule;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.inject.Provides;
import com.google.inject.Singleton;

public class WidgetClientModule extends AbstractGinModule {

	@Override
	protected void configure() {
					
	}
	
	/**
	 * Provides a map
	 * @param constants
	 * @param messages
	 * @return
	 */
	
	@Provides @Singleton MapWidget getMapWidget(GigMissionsConstants constants,GigMissionsMessages messages){
		
		LatLng centre = LatLng.newInstance(Double.parseDouble(messages.mapCentreLat()), Double.parseDouble(messages.mapCentreLon()));
		final MapWidget map = new MapWidget(centre,Integer.parseInt(messages.mapZoomLevel()));
		map.setScrollWheelZoomEnabled(true);
		map.setSize(constants.mapWidth(), constants.mapHeight());
		return map;
		
	}
	

}
